<!DOCTYPE html>
<html>
	<head>
		<#include "/templates/commons/head.html">
		<script type="text/javascript">
			function query() {
			    document.opForm.action = "${ctx!}/DemoController/queryList.do";
				document.opForm.submit();
			}
			/**
			*点击添加按钮进入添加页面
			*/
			function add(){
				document.opForm.action = "${ctx!}/DemoController/edit.do";
				document.opForm.submit();
			}
			function dialogEdit() {
			    layer.open({
					type: 2,
					title: "添加",
					shade: 0.4, //弹窗后边是否显示阴影 可以填true/false 或者0.？透明度
					shadeClose: true,//点击阴影是否关闭弹窗
					maxmin: true, //开启最大化最小化按钮
					closeBtn: 0, //不显示关闭按钮
					btn: ['确定','取消'],
					area: [document.body.clientWidth * 0.6 + "px", document.body.clientWidth * 0.6 / 1.2 + "px"],
					content: '${ctx!}/DemoController/edit.do',
					yes: function(index){
					    var iframeWin = window["layui-layer-iframe" + index];
					    iframeWin.dialogSave(function(message) {
						    Common.dialogEditCallback(index, message);
					    });
			    	},
			    	btn2: function(index) {
			    		layer.close(index);
			    	}
				});
			}
			/**
			*点击添加按钮进入添加页面
			*/
			function edit(id){
				document.opForm.action = "${ctx}/DemoController/edit.do?demoId="+id;
				document.opForm.submit();
			}
			/**
			*点击添加按钮进入添加页面
			*/
			function del(){
			    if(seleBox("ids")){
				    layer.confirm("您是否确定要删除？", {
					    	btn: ['确定', '取消']
						}, function() {
						    document.opForm.action = "${ctx!}/DemoController/del.do";
							document.opForm.submit();
						}, function() {
					});
				}
			}
		</script>
	</head>
	<body>
		<!-- list页面 start -->
		<div id="div-body" class="body">
			<form id="opForm" name="opForm" method="post" class="layui-form">
				<div class="search-head">
			        <!-- 顶部搜索&按钮栏 Start -->
			        <blockquote class="layui-elem-quote">
						<!-- 头部右边搜索条件 Start -->
			            <div class="layui-form layui-list-btn-group">
		                	<!-- 关键字搜索 Start -->
		                	<div class="input-block">
			                	<label class="layui-form-label">关键字</label>
			                    <div class="layui-input-inline">
			                        <input type="text" name="param_keyword" placeholder="请输入关键字" title="内容，备注" autocomplete="off" class="layui-input" value="${Request.param_keyword!}">
			                    </div>
		                	</div>
		                	<!-- 关键字搜索 End -->
			            </div>
			            <!-- 头部右边搜索条件 End -->
					</blockquote>
		        	<!-- 按钮 Start -->
			        <blockquote class="layui-elem-quote list-btn-group">
						<div class="layui-btn-group">
							<#if Session.CUR_MENU.addRole == 1>
								<button class="layui-btn" type="button" onclick="add();"><i class="layui-icon">&#xe654;</i>新增</button>
								<button class="layui-btn" type="button" onclick="dialogEdit();"><i class="layui-icon">&#xe654;</i>弹窗新增</button>
							</#if>
							<#if Session.CUR_MENU.deleteRole == 1>
								<button class="layui-btn" type="button" onclick="del();"><i class="layui-icon">&#xe640;</i>删除</button>
							</#if>
						</div>
						<#if Session.CUR_MENU.selectRole == 1>
							<button class="layui-btn query-btn layui-btn-danger" type="button" onclick="query();"><i class="layui-icon">&#xe615;</i>查询</button>
                        </#if>
			        </blockquote>
					<!-- 按钮 End -->
			        <!-- 顶部搜索&按钮栏End -->
		        </div>
		        <!-- table list group Start -->
		        <div id="container">
		        	<!-- message Start -->
		        	<div id="div-message">${message!}</div>
		        	<!-- message End -->
		        	<!-- table list Start -->
		        	<div class="data-grid-group">
		        		<table lay-filter="data-grid" class="layui-table dymanic-table">
		        			<thead>
		        				<tr>
									<th lay-data="{field:'ids', align: 'center', checkbox: true, width: '6%'}"></th>
									<th lay-data="{field:'uuid', align: 'center', width: '6%'}">序号</th>
									<th lay-data="{field:'type', align: 'center', sort:true, width: '10%'}">类型</th>
									<th lay-data="{field:'city', align: 'left', sort:true, width: '10%'}">城市</th>
									<th lay-data="{field:'context', align: 'left', width: '14%'}">内容</th>
									<th lay-data="{field:'remark', align: 'left', width: '10%'}">备注</th>
									<th lay-data="{field:'updateDate', align: 'center', width: '12%'}">更新时间</th>
									<th lay-data="{field:'updateBy', align: 'center', width: '10%'}">更新人</th>
									<th lay-data="{field:'createDate', align: 'center', width: '12%'}">创建时间</th>
									<th lay-data="{field:'createBy', align: 'center', width: '10%'}">创建人</th>
								</tr>
							</thead>
							<tbody>
								<#if resultList??>
									<#list resultList as demoBean>
										<tr>
											<td><input name="ids" type="checkbox" value="${demoBean.id}"/></td>
											<td>${demoBean_index + 1}</td>
											<td>
												<a href="javascript:void(0);" class="" onclick="edit(${demoBean.id!})"><@dict type='role_type' value='${demoBean.type!}'>${typeName!}</@dict></a>
											</td>
											<td><@city cityCode="${demoBean.city!''}">${cityName}</@city></td>
											<td>${demoBean.context!'-'}</td>
											<td>${demoBean.remark!'-'}</td>
											<td>${demoBean.updateDate!'-'}</td>
											<td>${demoBean.updateBy!'-'}</td>
											<td>${demoBean.createDate!'-'}</td>
											<td>${demoBean.createBy!'-'}</td>
										</tr>
									</#list>
								</#if>
							</tbody>
		        		</table>
		        		<!-- 分页 Start -->
						<div class="page-helper">
							<#include "/templates/commons/page.html">
						</div>
						<!-- 分页 End -->
		        	</div>
		        	<!-- table list End -->
	        	</div>
	        	<!-- table list group End -->
        	</form>
       	</div>
		<!-- list页面 end -->
	</body>
</html>